<layout name="layout" />

<div class="pageheader notab">
<!--<ul class="breadcrumbs breadcrumbs2">
    <li><a href="/">首页 &#47; 全部推广计划</a><span class="divider">&#187;</span></li>
    <li class="campaign-title-{$campaign.campaign_id}">{$campaign.title}</li>
</ul>-->
<h1 class="pagetitle">
		<a href="/" class="linkWay">首页/全部推广计划</a>
		&nbsp;<span class="divider">»</span>&nbsp;
		<a href="#" class="currentWay campaign-title-{$campaign.campaign_id}">{$campaign.title}</a>
	</h1>
</div>

<div id="contentwrapper" class="contentwrapper">
       <div id="tabs">
       		 <div class="tabs_header" >
       		 	
       		 	<if condition="$campaign.auto_type eq 0">
       		 	<!-- 非一键推广模式导航 -->
	             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" style="float:left">
	                 <li class="ui-state-default ui-corner-top"><a href="/promote/manual?campaign_id={$campaign.campaign_id}" style="background: #229fdd;color: #fff;">新建宝贝推广</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-review" href="#review" rel="/campaign/review?campaign_id={$campaign.campaign_id}">基本信息</a></li>
	                 <li class="ui-state-default ui-corner-top ui-state-active"><a id="tab-adgroups" href="#adgroups" rel="/campaign/adgroups?campaign_id={$campaign.campaign_id}">推广中的宝贝</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-area" href="#area" rel="/setting/area?campaign_id={$campaign.campaign_id}">地域投放</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-schedule" href="#schedule" rel="/setting/schedule?campaign_id={$campaign.campaign_id}">分时折扣设置</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-platform" href="#platform" rel="/campaign/platform?campaign_id={$campaign.campaign_id}">投放平台设置</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-log" href="#log">操作记录</a></li>
	             </ul>
	             </if>

       		 	<if condition="$campaign.auto_type eq 1">
       		 	<!-- 一键推广模式导航 -->
	             <ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" style="float:left">
	                 <li class="ui-state-default ui-corner-top"><a href="/promote/manual?campaign_id={$campaign.campaign_id}" style="background: #229fdd;color: #fff;">添加推广组</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-review" href="#review" rel="/campaign/review?campaign_id={$campaign.campaign_id}">基本信息</a></li>
	                 <li class="ui-state-default ui-corner-top ui-state-active"><a id="tab-adgroups" href="#adgroups" rel="/campaign/adgroups?campaign_id={$campaign.campaign_id}">推广中的宝贝</a></li>
	                 <!-- li class="ui-state-default ui-corner-top"><a id="tab-adgroups" href="#adgroups" rel="/campaign/sales?campaign_id={$campaign.campaign_id}&auto_type={$campaign.auto_type}">宝贝成交详情</a></li -->
	                 <li class="ui-state-default ui-corner-top"><a id="tab-area" href="#area" rel="/setting/area?campaign_id={$campaign.campaign_id}">地域投放</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-schedule" href="#schedule" rel="/setting/schedule?campaign_id={$campaign.campaign_id}">分时折扣设置</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-platform" href="#platform" rel="/campaign/platform?campaign_id={$campaign.campaign_id}">投放平台设置</a></li>
	                 <li class="ui-state-default ui-corner-top"><a id="tab-log" href="#log">操作记录</a></li>
	             </ul>
	             </if>

	           	<div id="sub_page_btns" style="float:right;padding-right:20px;">
                    <div id="table_datepicker"  style="float:left;display:block;"></div>
                    <div id="table_pager" style="float:left;"></div>
			    </div>
	         </div>

             <div id="tabs-body"></div>
	</div>

</div><!--contentwrapper-->

<!-- centercontent -->

<script id="template-logger" type="text/html">
	<div class="main action-logs">
	    <div style="float:left;padding-left:14px;background-color: #f0f0f0;width:100%;font-size:16px">
	     最近2周操作记录--推广计划
	    </div>
	    <br class="clearall" />
	    <div class="logger-container">
			<select name="" id="logType" class="type-selector">
				<option value="campaign">计划层面</option>
				<option value="adgroup">宝贝层面</option>
			</select>
			<div id="J_logs">
				<table class="metrotable normal_table">

				</table>
			</div>
			<div class="pagables">
				<button class="changePage prev-page">上一页</button>
				<button class="changePage next-page">下一页</button>
			</div>
	    </div>
	</div>
</script>

<script id="template-logger-logs" type="text/html">
	<% for(var i=0; i < content.length; ++i){ %>
	<tr >
		<td ><%= content[i].updated_time %></td>
		<td><label class="label"><%= content[i].action_type_name%></label></td>
		<td ><%= content[i].display %></td>
		<%
		var extra_note = content[i]['note'];
		if(extra_note != null && extra_note.length >= 4) {
		%>
		<td class="note_extra" >[ 标题 ]： <%=extra_note[1] %><br><%  if(extra_note[3].length > 35) extra_note[3] = extra_note[3].substring(0, 25) + '...' + extra_note[3].substring(extra_note[3].length - 10);%>
			[ 图片 ]： <a href="<%=extra_note[3] %>" target="_blank"><%=extra_note[3]%></a></td>
		<% } %>
	</tr>
	<% } %>
</script>

<script type="text/javascript">
var campaignID = {$campaign.campaign_id};
var userID = {$me.user_id};
$(document).ready(function(){
	var initTab = window.location.hash ? ('#tab-' + window.location.hash.substr(1)) : '#tab-adgroups';

	campaign.detail($('.contentwrapper'), {
		campaign_id: campaignID,
		user_id: userID,
		init_tab: initTab,
		$crumb: $('.pagetitle')
	}).init();

});


</script>
